<template>
  <div class="viewcontainer" v-if="dataset">
    <hi-toolbar :source="dataset" v-bind="toolbar"></hi-toolbar>
    <hi-form
      class="formtitle"
      ref="detailForm"
      :model="dataset.curRecord"
      :dataSource="dataset"
      v-bind="form"
    ></hi-form>
  </div>
</template>

<script>
// import { HiForm, HiToolbar } from "hi-ui";
//import flowView from "@/views/flow/flow";
import flowView from "@/views/base";
import datasetCfg from "./detail";
import withdrawTag from "@/views/component/withdrawTag";
export default {
  name: "withdrawDetail",
  extends: flowView,
  components: {
    // HiForm,
    // HiToolbar,
    withdrawTag,
  },

  data() {
    let dataset = null;
    return {
      //数据集配置
      datasetCfg: Object.assign({}, datasetCfg),

      //数据集
      dataset: dataset,

      toolbar: {
        buttons: [
          {
            kind: "save",
            //text: "保存",
            type: "danger",
            icon: "el-icon-upload",
          },
          {
            kind: "nexttache",
            // text: "流转",
            // type:"primary",
          },
          {
            kind: "backtache",
            // text: "回退",
            // type:"primary",
          },
        ],
      },
      //数据桥梁
      dataBridge: new Map(),
      //编辑数据
      editData: {},
      //表单配置
      form: {
        columnsTotal: 2,
        labelWidth: "180px",
        items: [
          {
            name: "apply_no",
          },

          {
            name: "apply_money_yuan",
            props: {
              min: 0,
              format: "￥0.00",
              precision: 2,
            },
          },
          {
            name: "shop_desc",
          },
          {
            name: "payee_name",
          },
          {
            name: "bank_name",
          },
          {
            name: "bank_account",
          },
          {
            name: "bank_addr",
          },

          {
            name: "fee_yuan",
            props: {
              min: 0,
              format: "￥0.00",
              precision: 2,
            },
          },
          // { name: "yrreality_money" },

          {
            name: "create_date",
          },
          {
            element: withdrawTag,
            name: "FAUDIT",
          },
          // {
          //   name: "payee_account",
          // },
        ],
      },
    };
  },
  model: {
    prop: "value",
    event: "valuechange",
  },
  props: {
    value: {
      type: Object,
    },
  },

  computed: {},
  watch: {},
  methods: {
    viewInit() {
      let me = this;
      // this.dataset.on("beforevalidateerror", (store) => {
      //   let cmps = ["detailForm"];
      //   for (let i = 0; i < cmps.length; i++) {
      //     let cmp = this.$refs[cmps[i]];
      //     cmp.validate((result, rules) => {
      //       store.cancel = !result;
      //     });
      //     if (store.cancel) break;
      //   }
      // });
      // debugger;
      //没有任务新增一条数据
      if (!this.flowinfo.ftaskguid) {
        this.queryEntity(
          { FNUMBER: this.userInfo.shopid },
          "database/shop/dataset/ShopEntity_account.xml"
        ).then((res) => {
          if (res.dataPack.rows.length == 0) return;
          let data = res.dataPack.rows[0];
          me.dataset.add({
            bank_name: data.FBANKDESC,
            bank_account: data.FBANKID,
            bank_addr: data.FBANKADDR,
            payee_name: data.FACCOUNTNAME,
            shop_desc: data.FDESC,
            shop_id: data.FNUMBER,
            payee_account: data.FSYSMONEYACCOUNT,
          });
        });
      }
    },
  },
  mounted() {
    debugger;
    this.datasetCfg.aliasName = "dataset";
    this.dsConfigs = [this.datasetCfg];
    this.dataBridge.set(this.datasetCfg.aliasName, ["detailForm"]);
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scope>
.formtitle {
  margin-top: 15px;
}
</style>
